Fix gdk_cairo_region_create_from_surface on big endian
authorMichel Dänzer <michel@daenzer.net>
Sat, 19 Nov 2011 17:23:27 +0000 (12:23 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 19 Nov 2011 17:23:27 +0000 (12:23 -0500)
gdk_cairo_region_create_from_surface doesn't work correctly on PPC.
This is most prominently seen with the GTK window resize grip, the
shape of which is mirrored every eight pixels horizontally.

At the same time, use an A1 surface for the resize grip shape to
eliminates an A8->A1 surface conversion.

gdk/gdkcairo.c
gtk/gtkwindow.c

index 2ae8b094594ee3d2421ea30528eb3f5f7eaa99d5..ea58c428f9d0df9b736e8da84dc888148eb8238f 100644 (file)
@@ -427,7 +427,11 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
           gint x0 = x;
           while (x < extents.width)
             {
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
               if (((data[x / 8] >> (x%8)) & 1) == 0)
+#else
+              if (((data[x / 8] >> (7-(x%8))) & 1) == 0)
+#endif
                 /* This pixel is "transparent"*/
                 break;
               x++;
index 657f9f8e6944edfc4114d0a0f3fabb0eb7d7465a..50370a589aeadfd9f87cd3785a63e77d06b69957 100644 (file)
@@ -5298,7 +5298,7 @@ set_grip_shape (GtkWindow *window)
 
   width = gdk_window_get_width (priv->grip_window);
   height = gdk_window_get_height (priv->grip_window);
-  surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
+  surface = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
 
   cr = cairo_create (surface);
   cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);